import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from "element-plus"
import 'element-plus/lib/theme-chalk/index.css';
import VueMarkdownEditor from '@kangc/v-md-editor';
import '@kangc/v-md-editor/lib/style/base-editor.css';
import vuepressTheme from '@kangc/v-md-editor/lib/theme/vuepress.js';
import '@kangc/v-md-editor/lib/theme/style/github.css';
import VMdPreview from '@kangc/v-md-editor/lib/preview';
import '@kangc/v-md-editor/lib/theme/style/vuepress.css';
import VMdPreviewHtml from '@kangc/v-md-editor/lib/preview-html';

//代码复制
import createCopyCodePreview from '@kangc/v-md-editor/lib/plugins/copy-code/index';
import '@kangc/v-md-editor/lib/plugins/copy-code/copy-code.css';
//验证模块
import SliderVerify from 'slider-verify-v3'
import 'slider-verify-v3/lib/SliderVerify.css'
//axios
import axios from "axios";
import './assets/iconfont/iconfont.css' //iconfont
import store from './store'
//代码行号
import createLineNumbertPlugin from '@kangc/v-md-editor/lib/plugins/line-number/index';
//代码高亮
import Prism from 'prismjs';
//emoji
import createEmojiPlugin from '@kangc/v-md-editor/lib/plugins/emoji/index';
import '@kangc/v-md-editor/lib/plugins/emoji/emoji.css';


axios.defaults.baseURL = 'https://apiblog.hwawy.cn/api'
axios.interceptors.response.use( (res) => {
    if ( res.data === "quick"){
        router.push({
            name: 'error',
            query: {info:1}
        })
    }
    return res;
})
const app = createApp(App);
app.config.globalProperties.$axios = axios;
VueMarkdownEditor.use(vuepressTheme, {
    Prism
});
VueMarkdownEditor.use(createEmojiPlugin());
VMdPreview.use(vuepressTheme, {
   Prism
});
VMdPreview.use(createCopyCodePreview());
VMdPreview.use(createLineNumbertPlugin());
VMdPreview.use(createEmojiPlugin());

createApp(App).use(store).use(VMdPreview).use(VMdPreviewHtml).use(SliderVerify).use(router).use(ElementPlus).use(VueMarkdownEditor).mount('#app')
